UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T95M9GDm/S6j0mYpUICHIVrmBssxPefJYWIvwqzi7fE=' 
WHERE 
  key_id = '9eb7514e76aeb1ab44d6ff23c9624d86d73278a2e400754d722cd039549dedc1' 
  AND (
    token = 'T95M9GDm/S6j0mYpUICHIVrmBssxPefJYWIvwqzi7fE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034