UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g8atNpTTa4WuvPEqK49wbmLhtJAqas3H7uvZvJeUsqs=' 
WHERE 
  key_id = '2c971b5852ec794b7e6b73b38a3682240e3263e763316c0626c908a01cb8fa3a' 
  AND (
    token = 'g8atNpTTa4WuvPEqK49wbmLhtJAqas3H7uvZvJeUsqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049