UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bCOQ0BHhE6b9ojTPvdzie0lI7rTfQkrIRzTmUzPLSKE=' 
WHERE 
  key_id = '9b6632d5ab3fdf41dff0d07118f2ddbb4c65edd61d91931af96412f65d2d1604' 
  AND (
    token = 'bCOQ0BHhE6b9ojTPvdzie0lI7rTfQkrIRzTmUzPLSKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029