UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WV4F/K4JCGea6DQ/uFWi23emqbOyX2Kqcpybr0wyE6Q=' 
WHERE 
  key_id = '798d020d6bab58511121a53637b1640ac6ae39b830c21cfccd839d95e404b35d' 
  AND (
    token = 'WV4F/K4JCGea6DQ/uFWi23emqbOyX2Kqcpybr0wyE6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033