UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WgFRgiJs39BqbdfWaaJDo/oTn6jTvDmtPlE7maxcEB8=' 
WHERE 
  key_id = '172f6d05ad112abe2a5506bc5808c61f99accf3d34d58fc5fe951d3ded36967f' 
  AND (
    token = 'WgFRgiJs39BqbdfWaaJDo/oTn6jTvDmtPlE7maxcEB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038