UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6cbhtXQdynNbm9w//U80389WbTk/oCw1jhQmb2ms3A=' 
WHERE 
  key_id = '2ac88303c3219c30af0747b29e31a000859a3c409ecc5bec93277b005b9b6d14' 
  AND (
    token = 'G6cbhtXQdynNbm9w//U80389WbTk/oCw1jhQmb2ms3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029