UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UgaE0Ff33E7jfeYZ0/TBFBA69CeLh6ZSs5zITYB37E0=' 
WHERE 
  key_id = '86f898b130a9eddb26f7daa8a78abf18004164b8be3b7d5f4c4e1989d8c470c1' 
  AND (
    token = 'UgaE0Ff33E7jfeYZ0/TBFBA69CeLh6ZSs5zITYB37E0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035