UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'caulnjYeENVq89sG5XMoiAiYOZ4T7DLpJlzHG+Nwy2U=' 
WHERE 
  key_id = 'a83c0c8eac36530092d5a3285a2ba8e4b4302ce5c06a532536526a759c9d7bcd' 
  AND (
    token = 'caulnjYeENVq89sG5XMoiAiYOZ4T7DLpJlzHG+Nwy2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021