UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jqmskxddfw46OZOIoj87gvLWA3V6yMSTfx2922XNcok=' 
WHERE 
  key_id = '37a2f2bef44d7f5285427a567a7756769fe83cfbc3a1062ec1b8f4d28491113a' 
  AND (
    token = 'jqmskxddfw46OZOIoj87gvLWA3V6yMSTfx2922XNcok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036