UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7W+4ze+e9r10tJvzDVNwrHMN8uEsdPkmOQi4dwBpMA=' 
WHERE 
  key_id = 'd7cb097299f76487a1045a6ce5950c42787dcc7c588003cf131983fd9d3ed522' 
  AND (
    token = 'Y7W+4ze+e9r10tJvzDVNwrHMN8uEsdPkmOQi4dwBpMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027