UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0CK5L3PnhB6/0kw+YvPQo1d+STmX3O0IY1cuh/qsaY=' 
WHERE 
  key_id = '6c2bf05f7743ac72bded2b2cda95612454ed50d229e948bb3d34197218a3e52f' 
  AND (
    token = 'n0CK5L3PnhB6/0kw+YvPQo1d+STmX3O0IY1cuh/qsaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035