UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NxbUpIdyx11wHaGskGjmS9EB/xUQADCdqj9LththCV8=' 
WHERE 
  key_id = '89bc2e68f93019e376fd2ba75b0daef8263e68335eb0370599005276c62c1947' 
  AND (
    token = 'NxbUpIdyx11wHaGskGjmS9EB/xUQADCdqj9LththCV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021