UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F/QhwHaVfE71P4qX0hC+Mx2NGh9/VisrZadaW+8KoEU=' 
WHERE 
  key_id = '251ff6d551c03da56ba511a8227ea739c5f4331acb15df121b76ec6a6c8f6304' 
  AND (
    token = 'F/QhwHaVfE71P4qX0hC+Mx2NGh9/VisrZadaW+8KoEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029