UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T2gn+qgxiwALxCZrIuB56+nBilPZwLXd54fwzlSGXzQ=' 
WHERE 
  key_id = '1dfaf464a1801fd086e43c29b6f9059da18635c4b43cbe3200b8df68cc0f14fc' 
  AND (
    token = 'T2gn+qgxiwALxCZrIuB56+nBilPZwLXd54fwzlSGXzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031