UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNHFld8AdCRVJEBhN7D/j6fxxUl62CXptXSdc2fQ9PA=' 
WHERE 
  key_id = '9b519bb483effe32ffc70b9fedbdba796ade86e5f12c39c0e568a7bfa6edb82b' 
  AND (
    token = 'nNHFld8AdCRVJEBhN7D/j6fxxUl62CXptXSdc2fQ9PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035