UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ziDlo9qPlXFkuokxIR6t8xwL6OFTj5vu4dnJQ4tw+g=' 
WHERE 
  key_id = '87285635090ea49c9a673adb7e1967e6af2ce63133491bf54d0823bba7759492' 
  AND (
    token = '8ziDlo9qPlXFkuokxIR6t8xwL6OFTj5vu4dnJQ4tw+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033