UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'icvovPCC5ej+euNkigHBXqMXywItm4YzZG3cxb3emKg=' 
WHERE 
  key_id = 'd23934fe6dc819f9ace7dbd4e57e786bfb713b5d669649679955de8c057fe596' 
  AND (
    token = 'icvovPCC5ej+euNkigHBXqMXywItm4YzZG3cxb3emKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034