UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBtsWwQWDuKdmO0iGrjzWfA9DDtC7uXjyPYvrFWrCZg=' 
WHERE 
  key_id = 'fc74ddbb39eaf5f38aaa2b4e437b584cf435324032a51744bcbd8617fe227fa3' 
  AND (
    token = 'fBtsWwQWDuKdmO0iGrjzWfA9DDtC7uXjyPYvrFWrCZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042