UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rp9NWXRZLEWw7zj/DF5C6lBtksLXDsYxZKnpfOd+rzk=' 
WHERE 
  key_id = '6e052bfb9faf4778e2ab26dd99a600abc6084cd74296e35fab2c4aaa7dc687cd' 
  AND (
    token = 'Rp9NWXRZLEWw7zj/DF5C6lBtksLXDsYxZKnpfOd+rzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041