UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DK0KiPx8vj1UiSxvUEIAfumTgYxrFxxIf/MVsbcddaA=' 
WHERE 
  key_id = '7776ab90923393ee0fb661434e38481176737a5384b69ecc18cf92a91aa5c7d1' 
  AND (
    token = 'DK0KiPx8vj1UiSxvUEIAfumTgYxrFxxIf/MVsbcddaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034