UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WKnAD6727pwl8i3YUs/7Vg4MXrr/p7wTFzAOMBjpqLg=' 
WHERE 
  key_id = '2d44eeb7773076609a76d4c72749e74a8ce566e1eea959014b8f8b0df96e3c19' 
  AND (
    token = 'WKnAD6727pwl8i3YUs/7Vg4MXrr/p7wTFzAOMBjpqLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042