UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ICH6lpMNMemsf8WvzTx0ew4+Vbh3dTjl4TDcUd34xs4=' 
WHERE 
  key_id = '1fd57c31f65de74fc0781a0a861c8dd3bccaface42d9e5bc3483f7bf13841214' 
  AND (
    token = 'ICH6lpMNMemsf8WvzTx0ew4+Vbh3dTjl4TDcUd34xs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025