UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iFoDVnIxzeXJy47te2QalINHjMkjg5gYVM0m1KqUM3o=' 
WHERE 
  key_id = '6c01c1ae87efd80a819d0f2110099126d3c951743dad0b20a5ece7cd12e0147c' 
  AND (
    token = 'iFoDVnIxzeXJy47te2QalINHjMkjg5gYVM0m1KqUM3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033