UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'juZLVZG1jAHlNQPXm0iCPW8PEUI9ieBtS8Se6oIoTKA=' 
WHERE 
  key_id = '844616dd89d4d8724942914639188ad8f8389f5a766fc6b270979d7e3f7ea092' 
  AND (
    token = 'juZLVZG1jAHlNQPXm0iCPW8PEUI9ieBtS8Se6oIoTKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037