UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u9fa6NVT5AhbOZD2XWMQrh0eEgDyt9FCzaptlx3G5+w=' 
WHERE 
  key_id = '3aae26c2645be14a21c60bbe06a460bc2acadfa7416682387769a53a591da1b0' 
  AND (
    token = 'u9fa6NVT5AhbOZD2XWMQrh0eEgDyt9FCzaptlx3G5+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034