UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VncC5k4PiaraDzmClqtT6U3iqIO34wcq968h1SMnjGE=' 
WHERE 
  key_id = 'd134a37401ef3b6b7d4b64f97924328d8a2c373a43dd3ae4bc3a36998104df00' 
  AND (
    token = 'VncC5k4PiaraDzmClqtT6U3iqIO34wcq968h1SMnjGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044