UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Thm8B+QZxJkD1I2ZDXVmeo27ngdaaDslBxwDUOGjBDU=' 
WHERE 
  key_id = 'b83b585dbe5bcdf15d7a01d6c5b5957b3557aae50a70df021809fbcfad4f3a19' 
  AND (
    token = 'Thm8B+QZxJkD1I2ZDXVmeo27ngdaaDslBxwDUOGjBDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050