UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9kY2tC/aFbyyTlLtVpCY8+aJ4jVcm6CgbK+EjGElRwU=' 
WHERE 
  key_id = 'fa1a1b942ad8b101cacff13920610d243b4de99cf1a12d8a7b62e67b8f88cc94' 
  AND (
    token = '9kY2tC/aFbyyTlLtVpCY8+aJ4jVcm6CgbK+EjGElRwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042