UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HpmvyOO6QuK31SpCatXohQI0h0HPGzNQbTp+tx98LWk=' 
WHERE 
  key_id = 'e6a628539d204622c94015e126d14f9347f0a9e6dd60d54f60d0af7ba0f08da3' 
  AND (
    token = 'HpmvyOO6QuK31SpCatXohQI0h0HPGzNQbTp+tx98LWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028