UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pSqET4IEyG+9hXl4yxCx3SMTZdbQm3/TYgPEJkHtmxU=' 
WHERE 
  key_id = '394fb7f521899ea8379b7271cbfcf6e4e6b1dc3a5bdfbc72862b48eb5c23ff83' 
  AND (
    token = 'pSqET4IEyG+9hXl4yxCx3SMTZdbQm3/TYgPEJkHtmxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030