UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOeOpWsnk+Lo/OhJ1e/U8fTZFa2jjpzFUzjX6DfMBgI=' 
WHERE 
  key_id = '51dbe190c332b005303e6b1f9b89c3638a6c7159abceec4e371f7c5f9ef629f4' 
  AND (
    token = 'kOeOpWsnk+Lo/OhJ1e/U8fTZFa2jjpzFUzjX6DfMBgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024