UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5fPFCUhrqED2ShGF9lfWudb18Bq29jdd6eM9xWRdl5Y=' 
WHERE 
  key_id = '936b351972fe4e2769e21cdeb1b860dc575c567541f28b984cf6067112172c01' 
  AND (
    token = '5fPFCUhrqED2ShGF9lfWudb18Bq29jdd6eM9xWRdl5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054