UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TV9UYNI5NeqbxeGsOgCtyZYacSa1aIWFeWs7irdtQ0g=' 
WHERE 
  key_id = 'e0df9e47ce123bc52ea6921feea2858c40b2907125436d28e22b6bb2deab3b54' 
  AND (
    token = 'TV9UYNI5NeqbxeGsOgCtyZYacSa1aIWFeWs7irdtQ0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00092