UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pR63oe/bPysECKiOb6/coT00ABGslUdZlWJcnISNpGY=' 
WHERE 
  key_id = 'c4c527ffe729aa096c15b9f4cb788139362e28cf84197cdc554bd4a65167f983' 
  AND (
    token = 'pR63oe/bPysECKiOb6/coT00ABGslUdZlWJcnISNpGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040