UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K9JhnHlNDCdRP2MX396gjU7stSf8YJlq6QQHOeH+1gU=' 
WHERE 
  key_id = '02f43c2e1994bc5302fc70b5ed9ac4cc8687c47f3a47d667c17b131a31b614a1' 
  AND (
    token = 'K9JhnHlNDCdRP2MX396gjU7stSf8YJlq6QQHOeH+1gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029