UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hwMupyrm9+iKH38+R6Ok1CZLcfAVekKcVJX/LQqAWx8=' 
WHERE 
  key_id = '0e1e19a3ed3b3056e41ff7b77d5759f0b34300808239c1bea29b1a76d3fe8bbe' 
  AND (
    token = 'hwMupyrm9+iKH38+R6Ok1CZLcfAVekKcVJX/LQqAWx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030