UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHuysBhk2zZR46XGGmf9f4WLaK+/VXfo5Rn+8J3+yqk=' 
WHERE 
  key_id = '479d5b33ddaefc4bc4307b24e01c645c9f1c70297539f8ed2d321d54fe595e8a' 
  AND (
    token = 'BHuysBhk2zZR46XGGmf9f4WLaK+/VXfo5Rn+8J3+yqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022