UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEBJP3ybCgqyeaD8xwllW4wj7G3R1L/m5Tl6Ja6RdzQ=' 
WHERE 
  key_id = 'a321047356822c4bfbc5ca34da82b0f683ad1c1ed51670810bfa33081a1bbc79' 
  AND (
    token = 'wEBJP3ybCgqyeaD8xwllW4wj7G3R1L/m5Tl6Ja6RdzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057