UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pc8RRpYh5fFEEg+HG/CqC3DH2MxQfK0qd7rNwCsf+WU=' 
WHERE 
  key_id = '49fa3cac8baa6773b224afd36d972c273b9fb621bb96dd98261594dafd258b8b' 
  AND (
    token = 'pc8RRpYh5fFEEg+HG/CqC3DH2MxQfK0qd7rNwCsf+WU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036