UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B0blmgBDiQ8UtgkvvqCnb7CV+XQWKtCA6bx7XB+G2rQ=' 
WHERE 
  key_id = '02e796037d2f8f0953112ad3c523a50688b555f740e00f0153a550be6501d841' 
  AND (
    token = 'B0blmgBDiQ8UtgkvvqCnb7CV+XQWKtCA6bx7XB+G2rQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027