UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mjSrotn6GsFRhh+ccJboB8XK3LTpBJcse8iv7nb9W/s=' 
WHERE 
  key_id = '4a52dc512a8a921445128920770a677091a79904a2842b241532a42ed0f0307d' 
  AND (
    token = 'mjSrotn6GsFRhh+ccJboB8XK3LTpBJcse8iv7nb9W/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040