UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZbuM5utkCmqvGSiK5om5tu+Tcamf8viXojkk2l6VIc=' 
WHERE 
  key_id = '63cc261a5dce69618aaa6c788b6f9cd3ebe9591220187bd195383d9124095931' 
  AND (
    token = 'wZbuM5utkCmqvGSiK5om5tu+Tcamf8viXojkk2l6VIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029