UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buvAOCRidTa4Bzf8I4gAHJJoKPttV0fbWXVCtJpU3ws=' 
WHERE 
  key_id = '150c74e2c41491ae704b367f750d5e77223c24ea0ec6d4189cf4a1e840037044' 
  AND (
    token = 'buvAOCRidTa4Bzf8I4gAHJJoKPttV0fbWXVCtJpU3ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034